<#include "./template.ftl">
<#macro head>
    <title>魔客专栏-Morketing</title>
    <link rel="stylesheet" href="${base}/client/css/moke.css">
</#macro>
    <#macro content>
        <div id="contents">
            <div class="main wrap clearfix">
                <div class="main-left moke-left f-l clearfix">
                    <div class="moke-hot new-moke">
                        <h2 class="title">新晋魔客</h2>
                        <ul>
                            <#list latestAuthors as author>
                                <li>
                                    <a href="${base}/moke/user/${author.id}">
                                    <div class="pic"><img width="100%" src="${base}/system/getImg?imgId=${author.photoUrl!''}&w=88&h=88" alt=""></div>
                                    </a>
                                ${author.nickName!''}
                                </li>
                            </#list>
                        </ul>
                    </div>

                    <#if hotAuthors??>
                    <div class="moke-hot">
                        <h2 class="title">热门魔客</h2>
                        <ul>
                            <#list hotAuthors as author>
                            <li>
                                <a href="${base}/moke/user/${author.id}">
                                    <div class="pic"><img width="100%" src="${base}/system/getImg?imgId=${author.photoUrl!''}&w=88&h=88" alt=""></div>
                                </a>
                                ${author.nickName!''}
                            </li>
                            </#list>
                        </ul>
                    </div>
                    </#if>

                    <div class="news-item show moke-list">
                        <#if articles??>
                            <#list articles as article>
                                <div class="li-item">
                                    <div class="f-l l">
                                        <a href="${base}/moke/posts/${article.id}"style="display: inline-block;width: inherit;height: inherit">
                                            <div style="height:100%;width:160%;margin-left: -30%;text-align: center">
                                                <img style="height:100%;width:auto" src="${base}/system/getImg?imgId=${article.postImg!''}&w=224&h=168" alt="">
                                            </div>
                                        </a>
                                    </div>
                                    <div class="cell">
                                        <h2><a href="${base}/moke/posts/${article.id}">${article.postTitle}</a></h2>
                                        <p>${article.postContent!''}</p>
                                        <div class="tips">
                                            <div class="from">
                                                <a href="${base}/moke/user/${article.postAuthor}">
                                                    <span class="name"><img width="100%" src="${base}/system/getImg?imgId=${article.authorPhoto!''}&w=48&h=48" alt="">${article.postAuthorStr}</span>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </#list>
                        </#if>
                    </div>
                </div>
                <div class="main-right f-r clearfix">
                    <div class="publish-btn moke-publish">
                        <h2>想发声？成为魔客,立即开通专栏!</h2>
                        <p>一起加入魔客大家庭，分享各种有趣的专栏文章。</p>
                        <a href="javascript:void(0)" onclick="apply()">申请加入</a>
                    </div>                    
                    
                    <#include "widget/weixin.ftl"/>
                </div>
            </div>   
        </div>
    </#macro>
<#macro js>
<script type="text/javascript">
    function apply(){
        if(window.confirm("确认申请加入魔客？")){
            jQuery.ajax({
                type: "POST",
                url: '${base}/moke/apply',
                dataType:"json",
                data: {},
                success: function(data){
                    if(data.status == 1) {
                        alert("申请成功，请等待审核！");
                    }else if(data.status == -1){
                        alert("您还没有登录，请登录！");
                        location.replace("${base}/login?redirect_url=" + window.location.href);
                    }
                },
                error: function (obj){
                    console.info(obj);
                }
            });
        }
    }
</script>

<script>

</script>
</#macro>
